<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
	<title>找回密码</title>
	<style type="text/css">
	*{
		margin: 0;
		padding:0;
		font-family: "微软雅黑";

	}
		body{
			width: 100%;
			height: 100%;
		}
		.ejct{
			display: none;
			width: 70%;
			height: 30%;
			position:absolute;
			top: 50%;
			margin: -25% 15% 0 15%;
			border: 1px solid #ccc;
			z-index: 666;
			background: white;
		}
		.str{
			width: 80%;
			height:50%;
			position: absolute;
			left:10%;
			padding-top: 20%;
			text-align: center;
		}
		.btn{
			display: block;
			width: 30%;
			height: 20%;
			position: absolute;
			bottom:10%;
			left: 35%;
			text-align: center;
			border: none;
			background: #ccc;
		}
		li{
			list-style: none;
		}
		.main{
			position: absolute;
			width: 100%;
			height: 100%;
		}
		.logo img{
			position: absolute;
			width: 33.3333%;
			margin-left: 33.3333%;
			margin-top: 18%;
		}
		.content{
			position: absolute;
			width: 80%;
			height: 50%;
			bottom:10%;
			left:10%;
		}
		.content ul{
			width: 100%;
			height:30%;
			float:left;
			border-radius: 2%;
			border:1px solid #14c29f;
			margin-bottom:10%;
		}
		.content li{
			width: 100%;
			height: 50%;
			float: left;
			border-bottom:1px solid #14c29f;
		}
		li input{
			float: left;
			height: 90%;
			width: 94%;
			border: none;
			outline: none;
			margin-left: 3%;
			font-size: 1rem;
			margin-top: 0.8%;
		}
		#li1{
			border: none;
		}
		#vft_code,#obtain{
			float: left;
			border: none;
			height: 90%;
		}
		#vft_code{
			width: 50%;
		}
		#obtain{
			width: 40%;
			background: none;
			border-left: 1px solid #14c29f;
			color: #2b2b2b;
		}
		#submit,#back{
			height: 17%;
			width: 47%;
			background: #00abfd;
			border: none;
			color: white;
			border-radius: 4px;
		}
		#back{
			float: right;
			background: #b2b2b2;
		}
	</style>
</head>
<body>
	<div class="ejct">
		<ul>
			<li class="str"></li>
			<input type="button" value="确定" class="btn">
		</ul>
	</div>
	<div class="main">
		<div class="logo">
			<img src="../../image/my/logo.png">
		</div>
		<div class="content">
			<ul>
				<li><input type="text" placeholder="请输入您的手机号" id="usernameMid"></li>
				<li id="li1"><input type="text" placeholder="输入验证码" id="vft_code"><input type="button" value="获取验证码" id="obtain"></li>
			</ul>
			<input type="button" value="登录" id="submit"><input type="button" value="取消" id="back">
			
		</div>
	</div>
	<script type="text/javascript" src="../../script/jquery-1.10.2.min.js"></script>
	<script type="text/javascript" src="../../script/common.js"></script>
	<script type="text/javascript">
		var str;
		var code;
		var newpaswd;
		var smscode;
	$(".btn").click(function(){
		$(".ejct").css("display","none");
	})
	$("#back").click(function(){
		 window.location.href="../login.html"; 
	})
	$("#obtain").click(function(){

		if($("#usernameMid").val()==""){
			$(".ejct").css("display","block");
			str="手机号不能为空或者输入不正确";
			$(".str").html(str);
		}
		else{
			var mid;
			var str;
			var code;
			var newpaswd;
		 	var smscode;
			code=$("#usernameMid").val();
			mid=code;
			if(mid.length==11&&_checkPhone(mid))
			{
				var post="regmid="+mid;
				ajaxcocRequest('../../../api/account/sendCode', 'post', post, function(msg){
					if(msg.code ==100){
						alert("短信发送成功");
					}else{
						$("body").append('<div class="wuwang"><img src="../../image/iconfont-wangluo.png"><p>网络拥堵，信息塞车</p></div>')
					}
				});	
			}else
			{
				alert("手机号码不正确，请重新输入！");
			}
			
			
			/**/
		}
	})
	$("#submit").click(function(){
		mid=code;
		newpaswd=$("#newPwd").val();
		smscode=$("#vft_code").val();
		newPwd=$("#newPwd1").val();
		if(newpaswd!=""&&smscode!=""&&newPwd1!=""&&usernameMid!=""){		
			if($("#newPwd").val()==$("#newPwd1").val()){
				var re=/^[0-9a-zA-Z.,]{6,18}$/;
				if(re.test(newpaswd)!=false){
					var bodyparam={"mid":$mid,"groupid":$groupid,"did":initdata.get('mysetinfo'),"newpaswd":"$newpaswd",smscode:"$smscode"};
				ajaxCoCRequest('../../../api/account/findpaswdbymidandcode','POST',bodyparam,function(msg){
					if(msg.code==100){
						var localData =  window.localStorage;
                    localData.setItem("userNumber",msg.info.n0);
                    localData.setItem("userUrl", msg.info.n1);
         			localData.setItem("userName",msg.info.n2);
         			localData.setItem("userSex",msg.info.n3);
         			localData.setItem("userNative",msg.info.n4);
         			localData.setItem("userBirthday",msg.info.n5);
         			localData.setItem("groupids",msg.info.n6);
         			localData.setItem("groupNames",msg.info.n7);
         			localData.setItem("currentGroupName",msg.info.n8);
         			localData.setItem("logoUrl",msg.info.n9);
         			localData.setItem("groupJob",msg.info.n10);
         			localData.setItem("messageCount",msg.info.n11);
         			window.location = "main.html";
					}
					else{
						$(".ejct").css("display","block");
						str="密码修改失败,您输入的信息有误！";
						$(".str").html(str);
					}
				})
				}
				else{
					$(".ejct").css("display","block");
					str="您输入的密码格式不正确，正确为：6-18位数字以及特殊符号.,";
					$(".str").html(str);
				}
			}
			else{
				$(".ejct").css("display","block");
				str="两次密码输入不同";
				$(".str").html(str);
			}
		}
		else{
			$(".ejct").css("display","block");
			str="手机号、密码、验证码不能为空";
			$(".str").html(str);
		}
	})
	</script>
</body>
</html>